import storage from 'good-storage'

// 存小区Id
const VILLAGE_ID = '__villageid__'

export function saveVillageId (villageid) {
  storage.set(VILLAGE_ID, villageid)
}

export function loadVillageId () {
  return storage.get(VILLAGE_ID)
}

// 存小区名称
const TITLE = '__title__'

export function saveTitle (title) {
  storage.set(TITLE, title)
}

export function loadTitle () {
  return storage.get(TITLE)
}

// 存城市名称
const CITY = '__city__'

export function saveCity (city) {
  storage.set(CITY, city)
}

export function loadCity () {
  return storage.get(CITY)
}

// 存城市Id
const CITY_ID = '__cityid__'

export function saveCityId (cityid) {
  storage.set(CITY_ID, cityid)
}

export function loadCityId () {
  return storage.get(CITY_ID)
}

export function clearCity () {
  storage.remove(CITY)
  return ''
}

// 存openid
const OPEN_ID = '__openid__'

export function saveOpenId (openid) {
  storage.set(OPEN_ID, openid)
}

export function loadOpenId () {
  return storage.get(OPEN_ID)
}

// 存用户名字和手机号码
const PHONE_NAME = '__phonename__'

export function savePhoneName (phonename) {
  storage.set(PHONE_NAME, phonename)
}

export function loadPhoneName () {
  return storage.get(PHONE_NAME)
}

// 存用户ID
const USER_ID = '__userid__'

export function saveUserId (userid) {
  storage.set(USER_ID, userid)
}

export function loadUserId () {
  return storage.get(USER_ID)
}

// 存查验点击的类别id
const CLICK_DATA = '__clickdata__'

export function saveClickData (clickdata) {
  storage.session.set(CLICK_DATA, clickdata)
}

export function loadClickData () {
  return storage.session.get(CLICK_DATA)
}

// 缓存电梯编号
const LIFT_NUM = '__liftnum__'

export function saveLiftNum (liftnum) {
  storage.session.set(LIFT_NUM, liftnum)
}

export function loadLiftNum () {
  return storage.session.get(LIFT_NUM)
}

export function clearLiftNum () {
  storage.session.remove(LIFT_NUM)
}

// 投票统计缓存小区苑幢单元
const AREAS_NAME = '__areasname__'

export function saveAreasName (areasname) {
  storage.session.set(AREAS_NAME, areasname)
}

export function loadAreasName () {
  return storage.session.get(AREAS_NAME)
}

// 缓存房屋租售市code
const CITY_CODE = '__citycode__'

export function saveCityCode (citycode) {
  storage.session.set(CITY_CODE, citycode)
}

export function loadCityCode () {
  return storage.session.get(CITY_CODE)
}

// 存时间戳
const TIME_STAMP = '__timestamp__'

export function saveTIME (timestamp) {
  storage.set(TIME_STAMP, timestamp)
}

export function loadTIME () {
  return storage.get(TIME_STAMP)
}

// 存放判断用户登录是否过期标识
const USER_OVER = '__userover__'

export function saveOVER (userover) {
  storage.set(USER_OVER, userover)
}

export function loadOVER () {
  return storage.get(USER_OVER)
}
